<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version='1.0' >
    <xsl:template match="diets">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="content"
                page-height="8.5in" page-width="12in"
                 margin-top="0.5in" margin-bottom="0.5in"
                 margin-left="1in" margin-right="1in">                  
                    <fo:region-body/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="content">
                <fo:flow flow-name="xsl-region-body">
                    <fo:block font-size="14pt" font-family="san-serif" line-height="23pt"
                            space-after.optimum="15pt" text-align="center" padding-top="3pt">
                                DIET'S INFORMATION
                    </fo:block>
                    <fo:table border-collapse="separate" table-layout="fixed">
                        <fo:table-column column-width="3cm"/>
                        <fo:table-column column-width="3cm"/>
                        <fo:table-column column-width="6cm"/>
                        <fo:table-column column-width="6cm"/>
                        <fo:table-column column-width="3cm"/>
                        <fo:table-column column-width="3cm"/>
                        <fo:table-column column-width="3cm"/>
                        <fo:table-body>
                            <fo:table-row>
                                <fo:table-cell text-align="center" column-number="1" border-color="black" border-width="0.5pt" border-style="solid">
                                    <fo:block>Diet ID</fo:block>
                                </fo:table-cell>
                                <fo:table-cell text-align="center" column-number="2" border-color="black" border-width="0.5pt" border-style="solid">
                                    <fo:block>Customer ID</fo:block>
                                </fo:table-cell>
                                <fo:table-cell text-align="center" column-number="3" border-color="black" border-width="0.5pt" border-style="solid">
                                    <fo:block>Date Time Begin</fo:block>
                                </fo:table-cell>
                                <fo:table-cell text-align="center" column-number="4" border-color="black" border-width="0.5pt" border-style="solid">
                                    <fo:block>Date Time End</fo:block>
                                </fo:table-cell>
                                <fo:table-cell text-align="center" column-number="5" border-color="black" border-width="0.5pt" border-style="solid">
                                    <fo:block>Diet Name</fo:block>
                                </fo:table-cell>
                                <fo:table-cell text-align="center" column-number="6" border-color="black" border-width="0.5pt" border-style="solid">
                                    <fo:block>Calorie Need</fo:block>
                                </fo:table-cell>
                                <fo:table-cell text-align="center" column-number="7" border-color="black" border-width="0.5pt" border-style="solid">
                                    <fo:block>isNew</fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <xsl:for-each select="diet">
                                <fo:table-row>
                                    <fo:table-cell column-number="1" border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block>
                                            <xsl:value-of select="dietID" />
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell column-number="2" border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block>
                                            <xsl:value-of select="customerID" />
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell column-number="3" border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block>
                                            <xsl:value-of select="dateTimeBegin" />
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell column-number="4" border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block>
                                            <xsl:value-of select="dateTimeEnd" />
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell column-number="5" border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block>
                                            <xsl:value-of select="dietName" />
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell column-number="6" border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block>
                                            <xsl:value-of select="calorieNeed" />
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell column-number="7" border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block>
                                            <xsl:value-of select="isNew" />
                                        </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </xsl:for-each>
                        </fo:table-body>
                    </fo:table>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>
</xsl:stylesheet>
